<template>
  <div id="payment">
    <div class="header">
      <Header :name="name"></Header>
    </div>
    <div v-for="item in pays" :key="item.id" class="pay-item">
      <div class="pay-icon">
        <img :src="'/' + item.icon" alt="" />
      </div>
      <p class="pay-name">{{ item.name }}</p>
      <p class="type" :style="item.flag ? 'color: #f6bb18' : 'color: #aaa'">
        {{ item.flag ? "已绑定" : "未绑定" }}
      </p>
    </div>
    <button class="adds">添加新卡</button>
  </div>
</template>

<script setup>
import { ref, reactive } from "vue";
import Header from "./Header.vue";
import { useRoute } from "vue-router";

const route = useRoute();
const name = route.query.name;
console.log(name);

const pays = reactive([
  { id: 1, name: "微信支付", icon: "wechat.png", flag: true },
  { id: 2, name: "支付宝支付", icon: "pay.png", flag: true },
  { id: 3, name: "苹果支付", icon: "apple.png", flag: false },
]);
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
}

#payment {
  width: 100vw;
  height: 100vh;
}

.pay-item {
  display: flex;
  line-height: 5rem;
  width: 90%;
  margin-left: 5%;
  height: 5rem;
  border: 1px solid rgb(206, 206, 206);
  border-radius: 1rem;
  margin-top: 1rem;
}

.pay-icon {
  width: 2.7rem;
  height: 2.5rem;
  margin-top: 0.9rem;
  margin-left: 1rem;
}

.pay-icon img {
  width: 100%;
  height: 100%;
}

.pay-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-left: 1rem;
}

.type {
  position: absolute;
  margin-left: 70%;
  color: #f6bb18;
}

.adds {
  width: 90%;
  height: 4rem;
  margin-left: 5%;
  margin-top: 1rem;
  border-radius: 1rem;
  border: none;
  background-color: #f6bb18;
  color: #fff;
  font-size: 1.2rem;
  position: absolute;
  bottom: 3rem;
}
</style>